<?php
require "dbcon.php";
require 'fungsi.php';
$i = tanggalan();
include("FusionCharts.php");
$id = $_GET['id'];
$bayi = get_bayi($id);
include 'header.php';
?>

        <script type="text/javascript" src="script/FusionCharts.js"></script>
        <script type="text/javascript" src="script/jquery-1.4.js"></script>
    </head>
    <body>
       <div id="content">
    <div id="content-grafik">
        <h1>Grafik Perkembangan</h1>
                <?php
                            $i = 0;

                            for ($a = 0; $a <= 36; $a++) {

                                $arrData[$i++][1] = $a;
                            }
                            $i = 0;
                            for ($a = 0; $a <= 36; $a++) {
                                if ($data[$a]['berat']) {

                                    $arrData[$a][2] = $data[$a]['berat'];
                                } else {
                                    $arrData[$a][2] = "";
                                }
                            }
                            $strXML = "<chart caption='Grafik Perkembangan Anak' bgSWF='images/KMS.jpg' canvasBgAlpha='0' numberPrefix='' xAxisName='Umur' yAxisMaxValue='26' decimals='1' >";

                            //Initialize <categories> element - necessary to generate a multi-series chart
                            $strCategories = "<categories>";

                            //Initiate <dataset> elements
                            $strDataCurr = "<dataset seriesName='Berat'>";
                            $strDataPrev = "<dataset seriesName='Usia'>";

                            //Iterate through the data
                            foreach ($arrData as $arSubData) {
                                //Append <category name='...' /> to strCategories
                                $strCategories .= "<category name='" . $arSubData[1] . "' />";
                                //Add <set value='...' /> to both the datasets
                                $strDataCurr .= "<set value='" . $arSubData[2] . "' />";
                                $strDataPrev .= "<set value='" . $arSubData[3] . "' />";
                            }

                            //Close <categories> element
                            $strCategories .= "</categories>";

                            //Close <dataset> elements
                            $strDataCurr .= "</dataset>";
                            $strDataPrev .= "</dataset>";

                            //Assemble the entire XML now
                            $strXML .= $strCategories . $strDataCurr . $strDataPrev . "</chart>";

                            //Create the chart - MS Column 3D Chart with data contained in strXML
                            echo renderChart("swf/ScrollLine2D.swf", "", $strXML, "productSales", 980,700, false, false);
                ?>
            </div>
       </div>
           <?php include 'footer.php';?>
